{include file='_header'}

<link href="/public/static/js/dist/star-rating/star-rating.css" media="all" rel="stylesheet" type="text/css"/>
<script src="/public/static/js/dist/star-rating/star-rating.js" type="text/javascript"></script>

<style>
    .input-group-sm .btn {padding: 4px 6px;}
    .trhead {border-left: 1px solid #e7eaec; border-right: 1px solid #e7eaec; background:#f8f8f8;}
    .trhead.bottom {border-bottom: 1px solid #e7eaec;}
    .trbody {border-bottom: 1px solid #e7eaec; border-right: 1px solid #e7eaec;}
    .trbody td {border-left: 1px solid #e7eaec;}
    .popover {font-family: '微软雅黑'; font-size: 12px;}
    .label {padding: 3px 5px;}
    .img-thumbnail,
    .multi-img-details .multi-item img {width: 100px; height: 100px;}
</style>

<div class="page-header">
    <!--<span class="pull-right">
        <a class="btn btn-primary btn-sm" href="{:webUrl('creditshop/comment/add')}"><i class="fa fa-plus"></i> 添加评价</a>
    </span>-->
    当前位置：
    <span class="text-primary">{if !empty($item)}{if empty($item['virtual'])}回复{else}编辑{/if}{else}添加{/if}评价 {if !empty($item)}<small>评价ID: {$item['id']}</small>{/if}</span>
</div>

<div class="page-content">
    <form  action="" method="post" class="form-horizontal form-validate" >
        {if !empty($item) && empty($item['virtual'])}
            <div class="form-group">
                <label class="col-lg control-label">参与记录编号</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="" class="form-control valid" value="{$item['logno']}" disabled>
                </div>
            </div>
        {/if}
        <div class="form-group">
            <label class="col-lg control-label">评价商品</label>
            <div class="col-sm-9 col-xs-12">
                {if empty($item) || (!empty($item) && !empty($item['virtual']))}
                    <?:tpl_selector('goodsid', array('required'=>false, 'preview'=>true, 'url'=>webUrl('goods/query'), 'items'=>$goods ,'readonly'=>true, 'buttontext'=>'选择商品', 'placeholder'=>'请选择商品'))?>
                {else}
                    <a class="input-group multi-img-details container" {if !empty($item['goodsid'])}href="{:webUrl('creditshop/goods/edit', array('id'=>$item['goodsid']))}" target="_blank"{/if}>
                        <div class="multi-item">
                            <img class="img-responsive img-thumbnail" src="{:tomedia($goods['thumb'])}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.png'"/>
                            <div class="img-nickname">{$goods['title']}</div>
                        </div>
                    </a>
                {/if}
            </div>
        </div>

        {if !empty($item) && empty($item['virtual'])}
            <div class="form-group">
                <label class="col-lg control-label">评价人</label>
                <div class="col-sm-9 col-xs-12">
                    <div class="input-group multi-img-details container">
                        <div class="multi-item">
                            <img class="img-responsive img-thumbnail" src="{$item['headimg']}" onerror="this.src='../addons/ewei_shopv2/static/images/noface.png'"/>
                            <div class="img-nickname">{$item['nickname']}</div>
                        </div>
                    </div>
                </div>
            </div>
        {else}
            <div class="form-group">
                <label class="col-lg control-label">评价人昵称</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="nickname" class="form-control valid" value="{$item['nickname']}">
                    <span class="help-block">用户昵称，如果不选择，默认从粉丝表中随机读取</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-lg control-label">评价人头像</label>
                <div class="col-sm-9 col-xs-12">
                    {:tpl_form_field_image2('headimg',$item['headimg'])}
                    <span class="help-block">用户头像，如果不选择，默认从粉丝表中随机读取</span>
                </div>
            </div>
        {/if}

        <div class="form-group">
            <label class="col-lg control-label">评价等级</label>
            <div class="col-sm-9 col-xs-12">
                {if !empty($item) && empty($item['virtual'])}
                    <div class="form-control-static" style="color:#ff6600; font-size: 20px;">
                        {if $item['level'] >= 1}<i class="fa fa-star"></i>{/if}
                        {if $item['level'] >= 2}<i class="fa fa-star"></i>{/if}
                        {if $item['level'] >= 3}<i class="fa fa-star"></i>{/if}
                        {if $item['level'] >= 4}<i class="fa fa-star"></i>{/if}
                        {if $item['level'] >= 5}<i class="fa fa-star"></i>{/if}
                    </div>
                {else}
                    <input value="{$item['level']}" type="number" name='level' class="rating" min=0 max=5 step=1 data-size="xs">
                    <span class='help-block text-danger' id='nolevel' style='display:none'>请选择评分等级</span>
                {/if}
            </div>
        </div>


        <div class="form-group-title">首次评价</div>

        <div class="form-group">
            <label class="col-lg control-label">首次评价</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="content" rows="3" {if !empty($item) && empty($item['virtual'])}disabled{/if}>{$item['content']}</textarea>
            </div>
        </div>

        {if !empty($item) && empty($item['virtual'])}
            {if !empty($item['images'])}
                <div class="form-group">
                    <label class="col-lg control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <div class="input-group multi-img-details container">
                            {loop $item['images'] $images}
                            <div class="multi-item">
                                <img class="img-responsive img-thumbnail" src="{$images}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.png'"/>
                            </div>
                            {/loop}
                        </div>
                    </div>
                </div>
            {/if}
        {else}
            <div class="form-group">
                <label class="col-lg control-label"></label>
                <div class="col-sm-9 col-xs-12">
                    {:tpl_form_field_multi_image2('images',iunserializer($item['images']))}
                </div>
            </div>
        {/if}

        <div class="form-group">
            <label class="col-lg control-label">首评时间</label>
            <div class="col-sm-9 col-xs-12">
                {if !empty($item) && empty($item['virtual'])}
                    <div class="form-control-static">{:date('Y-m-d H:i', $item['time'])}</div>
                {else}
                    {:tpl_form_field_date('time', !empty($item['time']) ? date('Y-m-d H:i',$item['time']) : date('Y-m-d H:i'),true)}
                    <span class='help-block'>如果不选择默认当前时间</span>
                {/if}
            </div>
        </div>

        {if !empty($item) && empty($item['virtual'])}
            <div class="form-group">
                <label class="col-lg control-label">首评审核</label>
                <div class="col-sm-9 col-xs-12">
                    <label class="radio-inline"><input type="radio" name="checked" value="0" {if empty($item['checked'])}checked="checked"{/if}> 待审核</label>
                    <label class="radio-inline"><input type="radio" name="checked" value="1" {if $item['checked']>0}checked="checked"{/if}> 审核通过</label>
                    <label class="radio-inline"><input type="radio" name="checked" value="-1" {if $item['checked']<0}checked="checked"{/if}> 审核不通过</label>
                </div>
            </div>
        {/if}

        <div class="form-group">
            <label class="col-lg control-label">首评回复</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="reply_content" rows="5">{$item['reply_content']}</textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                {:tpl_form_field_multi_image2('reply_images',iunserializer($item['reply_images']))}
            </div>
        </div>

    {if !empty($item['append_content']) || empty($item) || !empty($item['virtual'])}
        <div class="form-group-title">追加评价</div>

        <div class="form-group">
            <label class="col-lg control-label">追加评价</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="append_content" rows="5" {if !empty($item) && empty($item['virtual'])}disabled{/if}>{$item['append_content']}</textarea>
            </div>
        </div>

        {if !empty($item) && empty($item['virtual'])}
            {if !empty($item['append_images'])}
                <div class="form-group">
                    <label class="col-lg control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <div class="input-group multi-img-details container">
                            {loop $item['append_images'] $images}
                            <div class="multi-item">
                                <img class="img-responsive img-thumbnail" src="{$images}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.png'"/>
                            </div>
                            {/loop}
                        </div>
                    </div>
                </div>
            {/if}
        {else}
            <div class="form-group">
                <label class="col-lg control-label"></label>
                <div class="col-sm-9 col-xs-12">
                    {:tpl_form_field_multi_image2('append_images',iunserializer($item['append_images']))}
                </div>
            </div>
        {/if}

        <div class="form-group">
            <label class="col-lg control-label">追评时间</label>
            <div class="col-sm-9 col-xs-12">
                {if !empty($item) && empty($item['virtual'])}
                    <div class="form-control-static">{:date('Y-m-d H:i', $item['append_time'])}</div>
                {else}
                    {:tpl_form_field_date('append_time', !empty($item['append_time']) ? date('Y-m-d H:i',$item['append_time']) : date('Y-m-d H:i'),true)}
                    <span class='help-block'>如果不选择默认当前时间</span>
                {/if}
            </div>
        </div>

        {if !empty($item) && empty($item['virtual'])}
            <div class="form-group">
                <label class="col-lg control-label">追评审核</label>
                <div class="col-sm-9 col-xs-12">
                    <label class="radio-inline"><input type="radio" name="append_checked" value="0" {if empty($item['append_checked'])}checked="checked"{/if}> 待审核</label>
                    <label class="radio-inline"><input type="radio" name="append_checked" value="1" {if $item['append_checked']>0}checked="checked"{/if}> 审核通过</label>
                    <label class="radio-inline"><input type="radio" name="append_checked" value="-1" {if $item['append_checked']<0}checked="checked"{/if}> 审核不通过</label>
                </div>
            </div>
        {/if}

        <div class="form-group">
            <label class="col-lg control-label">追评回复</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="append_reply_content" rows="3">{$item['append_reply_content']}</textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                {:tpl_form_field_multi_image2('append_reply_images',iunserializer($item['append_reply_images']))}
            </div>
        </div>
    {/if}
        <div class="form-group"></div>
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <input type="submit" value="提交" class="btn btn-primary">
                <input type="button" name="back" onclick="history.back()" style="margin-left:10px;" value="返回列表" class="btn btn-default">
            </div>
        </div>
    </form>
</div>
{include file='_footer'}